using AutoMapper;
using OpenAiProxy.API.Dtos;
using OpenAiProxy.API.Models;

namespace OpenAiProxy.API.Profiles
{
    public class WindowsInfoProfile : Profile
    {
        public WindowsInfoProfile()
        {
            CreateMap<WindowsInfoForCreationDto, WindowsInfo>().ForMember(
                    dst => dst.Id,
                    opt => opt.MapFrom(src => $"{Guid.NewGuid()}".Replace("-", ""))
                )
                .ForMember(
                    dst => dst.CreateTime,
                    opt => opt.MapFrom(src => DateTime.Now)
                )
                .ForMember(
                    dst => dst.LastActivityTime,
                    opt => opt.MapFrom(src => DateTime.Now)
                ).ForMember(
                    dst => dst.Is64BitOs,
                    opt => opt.MapFrom(src => src.Is64BitOperatingSystem ? (byte)1 : (byte)0)
                );
        }
    }
}
